<?php
include_once("../module/checkA.php");
include_once("../../config.php");
?>

<div style="display:none">

    <?


    //设置需要搜索的表格的前缀后缀
    $table_suffix = "site";
    $table = $table_Prefix . $table_suffix;
    $sort_by = "nid";
    $sort_order = "desc";
    //设置需要搜索的表格的排序项和升降项


    ?>



<?php
//上传logo===========================================================

//print_r($_FILES["upfile"]);
if (is_uploaded_file($_FILES['site_logo']['tmp_name'])) {
    $upfile = $_FILES["site_logo"];
    //获取数组里面的值

    echo "收到要上传图片";

//获取当前日期
    $datename = date("Y-m-d H:i:s");
    $datename = str_replace("-", "", $datename);
    $datename = str_replace(" ", "", $datename);
    $datename = str_replace(":", "", $datename);


    $datename = $datename . "0";


//     $name=$upfile["name"];//上传文件的文件名,$name可以赋值其他值来到改变文件名,获取日期+时分秒来到改名最佳。而存放地点则按照月份来区分

    $name = $upfile["name"]; //上传的文件名改为时间命名
    $cutto = strrpos($name, "."); //返回第二个字符串在第一个字符串第一次出现的位置，第一个字符位置算0
    $name = substr_replace($name, $datename, 0, $cutto);


    $type = $upfile["type"]; //上传文件的类型


    $size = $upfile["size"]; //上传文件的大小
    $tmp_name = $upfile["tmp_name"]; //上传文件的临时存放路径
    /*
    这是一种非常简单文件上传方式。基于安全方面的考虑，您应当增加有关什么用户有权上传文件的限制。
    上传限制
    在这个脚本中，我们增加了对文件上传的限制。用户只能上传 .gif 或 .jpeg 文件
    */
    switch ($type) {
        case 'image/pjpeg':
            $okType = true;
            break;
        case 'image/jpeg':
            $okType = true;
            break;
        case 'image/gif':
            $okType = true;
            break;
        case 'image/png':
            $okType = true;
            break;
    }


    if ($okType) {
        /**
         * 0:文件上传成功<br/>
         * 1：超过了文件大小，在php.ini文件中设置<br/>
         * 2：超过了文件的大小MAX_FILE_SIZE选项指定的值<br/>
         * 3：文件只有部分被上传<br/>
         * 4：没有文件被上传<br/>
         * 5：上传文件大小为0
         */
        $error = $upfile["error"]; //上传后系统返回的值
        echo "================<br/>";
        echo "上传文件名称是：" . $name . "<br/>";
        echo "上传文件类型是：" . $type . "<br/>";
        echo "上传文件大小是：" . $size . "<br/>";
        echo "上传后系统返回的值是：" . $error . "<br/>";
        echo "上传文件的临时存放路径是：" . $tmp_name . "<br/>";

        echo "开始移动上传文件<br/>";
        //把上传的临时文件移动到up目录下面
        move_uploaded_file($tmp_name, '../../uploadfiles/' . $theme_folder . '/' . $name);
        $logo = $name;
        echo "================<br/>";
        echo "上传信息：<br/>";
        if ($error == 0) {
            echo "文件上传成功啦！";
            echo "<br>图片预览:<br>";
            echo "<img src=" . $destination . ">";
            //echo " alt="图片预览:r文件名:".$destination."r上传时间:">";
        } elseif ($error == 1) {
            echo "超过了文件大小，在php.ini文件中设置";
        } elseif ($error == 2) {
            echo "超过了文件的大小MAX_FILE_SIZE选项指定的值";
        } elseif ($error == 3) {
            echo "文件只有部分被上传";
        } elseif ($error == 4) {
            echo "没有文件被上传";
        } else {
            echo "上传文件大小为0";
        }
    } else {
        echo "请上传jpg,gif,png等格式的图片！";
    }


    $sql = "update $table SET logo = '$logo' where nid='0'";
    sql_log($sql);
$query = mysql_query($sql) or die ('保存contact表失败查询失败');
    mysql_close($con);

    echo "上传图片了";

}
?>






    <?php


    //上传logo2===========================================================

    //print_r($_FILES["upfile"]);
    if (is_uploaded_file($_FILES['site_logo2']['tmp_name'])) {
        $upfile = $_FILES["site_logo2"];
        //获取数组里面的值

        echo "收到要上传图片";

//获取当前日期
        $datename = date("Y-m-d H:i:s");
        $datename = str_replace("-", "", $datename);
        $datename = str_replace(" ", "", $datename);
        $datename = str_replace(":", "", $datename);


        $datename = $datename . "0";


//     $name=$upfile["name"];//上传文件的文件名,$name可以赋值其他值来到改变文件名,获取日期+时分秒来到改名最佳。而存放地点则按照月份来区分

        $name = $upfile["name"]; //上传的文件名改为时间命名
        $cutto = strrpos($name, "."); //返回第二个字符串在第一个字符串第一次出现的位置，第一个字符位置算0
        $name = substr_replace($name, $datename, 0, $cutto);


        $type = $upfile["type"]; //上传文件的类型


        $size = $upfile["size"]; //上传文件的大小
        $tmp_name = $upfile["tmp_name"]; //上传文件的临时存放路径
        /*
        这是一种非常简单文件上传方式。基于安全方面的考虑，您应当增加有关什么用户有权上传文件的限制。
        上传限制
        在这个脚本中，我们增加了对文件上传的限制。用户只能上传 .gif 或 .jpeg 文件
        */
        switch ($type) {
            case 'image/pjpeg':
                $okType = true;
                break;
            case 'image/jpeg':
                $okType = true;
                break;
            case 'image/gif':
                $okType = true;
                break;
            case 'image/png':
                $okType = true;
                break;
        }


        if ($okType) {
            /**
             * 0:文件上传成功<br/>
             * 1：超过了文件大小，在php.ini文件中设置<br/>
             * 2：超过了文件的大小MAX_FILE_SIZE选项指定的值<br/>
             * 3：文件只有部分被上传<br/>
             * 4：没有文件被上传<br/>
             * 5：上传文件大小为0
             */
            $error = $upfile["error"]; //上传后系统返回的值
            echo "================<br/>";
            echo "上传文件名称是：" . $name . "<br/>";
            echo "上传文件类型是：" . $type . "<br/>";
            echo "上传文件大小是：" . $size . "<br/>";
            echo "上传后系统返回的值是：" . $error . "<br/>";
            echo "上传文件的临时存放路径是：" . $tmp_name . "<br/>";

            echo "开始移动上传文件<br/>";
            //把上传的临时文件移动到up目录下面
            move_uploaded_file($tmp_name, '../../uploadfiles/' . $theme_folder . '/' . $name);
            $logo2 = $name;
            echo "================<br/>";
            echo "上传信息：<br/>";
            if ($error == 0) {
                echo "文件上传成功啦！";
                echo "<br>图片预览:<br>";
                echo "<img src=" . $destination . ">";
                //echo " alt="图片预览:r文件名:".$destination."r上传时间:">";
            } elseif ($error == 1) {
                echo "超过了文件大小，在php.ini文件中设置";
            } elseif ($error == 2) {
                echo "超过了文件的大小MAX_FILE_SIZE选项指定的值";
            } elseif ($error == 3) {
                echo "文件只有部分被上传";
            } elseif ($error == 4) {
                echo "没有文件被上传";
            } else {
                echo "上传文件大小为0";
            }
        } else {
            echo "请上传jpg,gif,png等格式的图片！";
        }


         $sql = "update $table SET logo2 = '$logo2' where nid='0'";
        sql_log($sql);
$query = mysql_query($sql) or die ('保存contact表失败查询失败');
        mysql_close($con);

        echo "上传图片了";

    }

    ?>







<?php
//上传icon===========================================================

//print_r($_FILES["upfile"]);
if (is_uploaded_file($_FILES['site_icon']['tmp_name'])) {
    $upfile = $_FILES["site_icon"];
    //获取数组里面的值


//获取当前日期
    $datename = date("Y-m-d H:i:s");
    $datename = str_replace("-", "", $datename);
    $datename = str_replace(" ", "", $datename);
    $datename = str_replace(":", "", $datename);


    $datename = $datename . "0";


//     $name=$upfile["name"];//上传文件的文件名,$name可以赋值其他值来到改变文件名,获取日期+时分秒来到改名最佳。而存放地点则按照月份来区分

    $name = $upfile["name"]; //上传的文件名改为时间命名
    $cutto = strrpos($name, "."); //返回第二个字符串在第一个字符串第一次出现的位置，第一个字符位置算0
    $name = substr_replace($name, $datename, 0, $cutto);


    $type = $upfile["type"]; //上传文件的类型


    $size = $upfile["size"]; //上传文件的大小
    $tmp_name = $upfile["tmp_name"]; //上传文件的临时存放路径
    /*
    这是一种非常简单文件上传方式。基于安全方面的考虑，您应当增加有关什么用户有权上传文件的限制。
    上传限制
    在这个脚本中，我们增加了对文件上传的限制。用户只能上传 .gif 或 .jpeg 文件
    */
    switch ($type) {
        case 'image/pjpeg':
            $okType = true;
            break;
        case 'image/jpeg':
            $okType = true;
            break;
        case 'image/gif':
            $okType = true;
            break;
        case 'image/png':
            $okType = true;
            break;
        case 'image/x-icon':
            $okType = true;
            break;
    }


    if ($okType) {
        /**
         * 0:文件上传成功<br/>
         * 1：超过了文件大小，在php.ini文件中设置<br/>
         * 2：超过了文件的大小MAX_FILE_SIZE选项指定的值<br/>
         * 3：文件只有部分被上传<br/>
         * 4：没有文件被上传<br/>
         * 5：上传文件大小为0
         */
        $error = $upfile["error"]; //上传后系统返回的值
        echo "================<br/>";
        echo "上传文件名称是：" . $name . "<br/>";
        echo "上传文件类型是：" . $type . "<br/>";
        echo "上传文件大小是：" . $size . "<br/>";
        echo "上传后系统返回的值是：" . $error . "<br/>";
        echo "上传文件的临时存放路径是：" . $tmp_name . "<br/>";

        echo "开始移动上传文件<br/>";
        //把上传的临时文件移动到up目录下面
        move_uploaded_file($tmp_name, '../../uploadfiles/' . $theme_folder . '/' . $name);
        $icon = $name;
        echo "================<br/>";
        echo "上传信息：<br/>";
        if ($error == 0) {
            echo "文件上传成功啦！";
            echo "<br>图片预览:<br>";
            echo "<img src=" . $destination . ">";
            //echo " alt="图片预览:r文件名:".$destination."r上传时间:">";
        } elseif ($error == 1) {
            echo "超过了文件大小，在php.ini文件中设置";
        } elseif ($error == 2) {
            echo "超过了文件的大小MAX_FILE_SIZE选项指定的值";
        } elseif ($error == 3) {
            echo "文件只有部分被上传";
        } elseif ($error == 4) {
            echo "没有文件被上传";
        } else {
            echo "上传文件大小为0";
        }
    } else {
        echo "请上传jpg,gif,png等格式的图片！";
    }


    $sql = "update $table SET icon = '$icon' where nid='0'";
    sql_log($sql);
$query = mysql_query($sql) or die ('保存contact表失败查询失败');
    mysql_close($con);


}
?>






<?php

$new_site_name        = addslashes($_REQUEST['site_name']);
$new_site_domin       = addslashes($_REQUEST['site_domin']);
$new_site_subdomain    = addslashes($_REQUEST['site_subdomain']);

$new_site_chdomin    = addslashes($_REQUEST['site_chdomin']);
$new_site_spdomin    = addslashes($_REQUEST['site_spdomin']);
$new_site_jpdomin    = addslashes($_REQUEST['site_jpdomin']);
$new_site_krdomin    = addslashes($_REQUEST['site_krdomin']);
$new_site_chwdomin    = addslashes($_REQUEST['site_chwdomin']);

$new_site_m_subdomin    = addslashes($_REQUEST['site_m_subdomin']);
$new_site_m_chdomin    = addslashes($_REQUEST['site_m_chdomin']);
$new_site_m_spdomin    = addslashes($_REQUEST['site_m_spdomin']);
$new_site_m_jpdomin    = addslashes($_REQUEST['site_m_jpdomin']);
$new_site_m_krdomin    = addslashes($_REQUEST['site_m_krdomin']);
$new_site_m_chwdomin    = addslashes($_REQUEST['site_m_chwdomin']);

$new_site_admin_url   = addslashes($_REQUEST['site_admin_url']);
$new_site_storage     = addslashes($_REQUEST['site_storage']);
$mobile_domain        = addslashes($_REQUEST['ai_mobile_domain']);
$mobile_switch        = addslashes($_REQUEST['ai_mobile_switch']);
$new_site_title       = addslashes($_REQUEST['site_title']);
$new_site_keyword     = addslashes($_REQUEST['site_keyword']);
$new_site_description = addslashes($_REQUEST['site_description']);

 

$new_site_mmail01     = addslashes($_REQUEST['site_mmail01']);
$new_site_mmail02     = addslashes($_REQUEST['site_mmail02']);
$new_site_mmail03     = addslashes($_REQUEST['site_mmail03']);
$new_site_mmail04     = addslashes($_REQUEST['site_mmail04']);
$new_site_mmail05     = addslashes($_REQUEST['site_mmail05']);



$new_site_msms01      = addslashes($_REQUEST['site_msms01']);
$new_site_msms02      = addslashes($_REQUEST['site_msms02']);
$new_site_msms03      = addslashes($_REQUEST['site_msms03']);
$new_site_msms04      = addslashes($_REQUEST['site_msms04']);
$new_site_msms05      = addslashes($_REQUEST['site_msms05']);



$new_site_video_url   = addslashes($_REQUEST['site_video_url']);




//php验证电话号码是否全部数字,并且数位是否11位
if ((!is_numeric($new_site_msms01)) || (strlen($new_site_msms01) != 11)) {
    $new_site_msms01 = "";
}

if ((!is_numeric($new_site_msms02)) || (strlen($new_site_msms02) != 11)) {
    $new_site_msms02 = "";
}

if ((!is_numeric($new_site_msms03)) || (strlen($new_site_msms03) != 11)) {
    $new_site_msms03 = "";
}

if ((!is_numeric($new_site_msms04)) || (strlen($new_site_msms04) != 11)) {
    $new_site_msms04 = "";
}

if ((!is_numeric($new_site_msms05)) || (strlen($new_site_msms05) != 11)) {
    $new_site_msms05 = "";
}














$new_site_chdomin    = addslashes($_REQUEST['site_chdomin']);
$new_site_spdomin    = addslashes($_REQUEST['site_spdomin']);
$new_site_jpdomin    = addslashes($_REQUEST['site_jpdomin']);
$new_site_krdomin    = addslashes($_REQUEST['site_krdomin']);
$new_site_chwdomin    = addslashes($_REQUEST['site_chwdomin']);




 $sql = "update $table SET
	name             =    '$new_site_name',
	mobile_domain    =    '$mobile_domain',
	mobile_switch    =    '$mobile_switch',

	domin            =    '$new_site_domin',
	subdomain        =    '$new_site_subdomain',

	chdomin        =    '$new_site_chdomin',
	spdomin        =    '$new_site_spdomin',
	jpdomin        =    '$new_site_jpdomin',
	krdomin        =    '$new_site_krdomin',
	chwdomin        =    '$new_site_chwdomin',
	
	m_subdomain        =    '$new_site_m_subdomin',
	m_chdomin        =    '$new_site_m_chdomin',
	m_spdomin        =    '$new_site_m_spdomin',
	m_jpdomin        =    '$new_site_m_jpdomin',
	m_krdomin        =    '$new_site_m_krdomin',
	m_chwdomin        =    '$new_site_m_chwdomin',
	
	search_default        =    '".addslashes($_REQUEST['site_search_default'])."',
	search_placeholder        =   '".addslashes($_REQUEST['site_search_placeholder'])."',
	show_hot_search        =    '".addslashes($_REQUEST['site_show_hot_search'])."',
	show_true_hot_search        =   '".intval($_REQUEST['site_show_true_hot_search'])."',
	show_hot_search_number        =   '".intval($_REQUEST['site_show_hot_search_number'])."',
	hot_search        =     '".addslashes($_REQUEST['site_hot_search'])."',

	admin_url        =    '$new_site_admin_url',
	storage          =    '$new_site_storage',

	title            =    '$new_site_title',
	keyword          =    '$new_site_keyword',
	description      =    '$new_site_description',
	 
    video_url         = '$new_site_video_url',

    mmail01          =    '$new_site_mmail01',
    mmail02          =    '$new_site_mmail02',
    mmail03          =    '$new_site_mmail03',
    mmail04          =    '$new_site_mmail04',
    mmail05          =    '$new_site_mmail05',


	msms01           =    '$new_site_msms01',
    msms02           =    '$new_site_msms02',
    msms03           =    '$new_site_msms03',
    msms04           =    '$new_site_msms04',
    msms05           =    '$new_site_msms05'

	".$where."
	where nid='0'";





if(($new_site_name=="")or($new_site_domin=="")or($new_site_title==""))
{
?>

    <script type="text/javascript">
        alert("必填项不能为空.");
        document.location.href = "edit.php";
    </script>

<?

    exit;
}
else
{
sql_log($sql);
$query = mysql_query($sql) or die ("error:".mysql_error());
mysql_close($con);
}

?>




<script type="text/javascript">
    alert("输入信息已保存，点击确认返回继续操作.");
    document.location.href = "edit.php";
</script>
</div>










